* {
    margin: 0;
    padding: 0;
}

body {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #333, #000);
}
.container {
    width: 500px;
    height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    &:hover {
        .out-front {
            transform: translateZ(200px);
        }
        .out-back {
            transform: translateZ(-200px) rotateY(180deg);
        }
        .out-left {
            transform: translateX(-200px) rotateY(-90deg);
        }
        .out-right {
            transform: translateX(200px) rotateY(90deg);
        }
        .out-top {
            transform: translateY(-200px) rotateX(90deg);
        }
        .out-bottom {
            transform: translateY(200px) rotateX(-90deg);
        }
    }
}

.out-div img {
    width: 200px;
    height: 200px;
    object-fit: cover;
}

.in-div img {
    width: 100px;
    height: 100px;
    object-fit: cover;
}

.box {
    position: absolute;
    width: 200px;
    height: 200px;
    // 开启3D效果
    transform-style: preserve-3d;
    animation: rotateAnimate 10s linear infinite;
}
.out-div {
    width: 200px;
    height: 200px;
    position: absolute;
    transition: transform 1s ease-in;
}

.out-front {
    transform: translateZ(100px);
}
.out-back {
    transform: translateZ(-100px) rotateY(180deg);
}
.out-left {
    transform: translateX(-100px) rotateY(-90deg);
}
.out-right {
    transform: translateX(100px) rotateY(90deg);
}
.out-top {
    transform: translateY(-100px) rotateX(90deg);
}
.out-bottom {
    transform: translateY(100px) rotateX(-90deg);
}

.in-div {
    margin-left: 50px;
    margin-top: 50px;
    width: 100px;
    height: 100px;
    position: absolute;
}
.in-front {
    transform: translateZ(50px);
}
.in-back {
    transform: translateZ(-50px) rotateY(180deg);
}
.in-left {
    transform: translateX(-50px) rotateY(-90deg);
}
.in-right {
    transform: translateX(50px) rotateY(90deg);
}
.in-top {
    transform: translateY(-50px) rotateX(90deg);
}
.in-bottom {
    transform: translateY(50px) rotateX(-90deg);
}
@keyframes rotateAnimate {
    0% {
        transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
    }
    100% {
        transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg);
    }
}
